/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: adol book
 * Date: 2022-05-03
 * Time: 10:05
 */
class Annimals{
    public String name;
    public void eat(){
        System.out.println(this.name+"正在吃");
    }
}
class Dog extends Annimals {
    @Override
    public void eat() {
        System.out.println(this.name+"吃狗粮");
    }

    public void run() {
        System.out.println(this.name + "正在跑");
    }
}
public class Demo {
    public static void main(String[] args) {
        Annimals annimals = new Dog();
        annimals.name = "小西";
        annimals.eat();

//        dog.name = "lucky"; //子类引用父类成员变量
//        dog.age = 3; //子类引用父类成员变量
//        dog.eat();//子类引用父类成员变量
//        dog.run();//子类引用自己的成员变量
//        Annimals annimals = new Annimals();
//        annimals.name = "haha";
//        annimals.age = 23;
//        annimals.eat();
    }
}
